﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 任务状态
{
    public class CustomTrackBar : TrackBar
    {
        protected override void OnPaint(PaintEventArgs e)
        {
            // 设置绘制质量
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            // 自定义滑块的大小
            int thumbSize = 8;
            Rectangle thumbRect = new Rectangle(
                this.Value * (this.Width - thumbSize) / this.Maximum,
                (this.Height - thumbSize) / 2,
                thumbSize,
                thumbSize);

            // 绘制背景
            e.Graphics.FillRectangle(Brushes.Gray, new Rectangle(0, this.Height / 2 - 2, this.Width, 4));

            // 绘制滑块
            e.Graphics.FillEllipse(Brushes.Blue, thumbRect);
        }
    }
}
